set(WAKAAMA_TOP_LEVEL_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")

set(LWM2M_COAP_DEFAULT_BLOCK_SIZE
    1024
    CACHE STRING "Default CoAP block size; Used if not set on a per-target basis"
)

function(target_sources_wakaama target)
    target_sources(
        ${target}
        PRIVATE ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/er-coap-13/er-coap-13.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/er-coap-13/er-coap-13.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/block.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/bootstrap.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/connection.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/data.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/discover.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/json.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/json_common.c 
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/liblwm2m.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/list.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/management.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/objects.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/observe.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/packet.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/platform.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/registration.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/senml_json.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/transaction.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/uri.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/utils.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/utils.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/objects/object_security.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/objects/object_server.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/objects/object_test.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/objects/object_device.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/lwm2mclient.c
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/lwm2mclient.h
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/internals.h
                ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/liblwm2m.h
    )

    target_include_directories(${target} PUBLIC ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core)
    target_include_directories(${target} PUBLIC ${WAKAAMA_TOP_LEVEL_DIRECTORY}/core/er-coap-13)
    target_include_directories(${target} PUBLIC ${WAKAAMA_TOP_LEVEL_DIRECTORY})


    target_compile_definitions(${target} PRIVATE "LWM2M_COAP_DEFAULT_BLOCK_SIZE=${LWM2M_COAP_DEFAULT_BLOCK_SIZE}")
    target_compile_definitions(lwm2mclient PRIVATE LWM2M_CLIENT_MODE  LWM2M_SUPPORT_SENML_JSON )

endfunction()

add_executable(lwm2mclient)

target_sources_wakaama(lwm2mclient)








